<?php
namespace app\api\controller;

use app\api\model\UserModel;
use app\api\model\TokenModel as Token;

class Index extends Base
{
    public $user;
    public $userToken;

    public function __construct()
    {
        parent::__construct();
        $this->user = new UserModel();
        $this->userToken = new Token();
    }

    public function index(){
        $list = $this->user->order("u_money desc")->field("u_nickname,u_money")->limit(10)->select();
        if(empty($list)){
            $this->error("暂时没有信息",'','401');
        }else{
            $this->success("",$list,'1');
        }
    }

    public function get_uid(){
        $data = input();
        $token = $data['token'];
        $uid = $this->userToken->getToken($token);
        if($uid){
            $this->success("",$uid,'1');
        }else{
            $this->error("",0,40001);
        }
    }
}
?>